<?php
	
	include 'connection.php';


	$q=$_GET['q'];
	$my_data=mysql_real_escape_string($q);

	//$sql="select ac_customer.CustomerName from ac_customer where ac_customer.CustomerName like '".$my_data."%' and ac_customer.Activest=1";
	$sql="select DISTINCT buying_document.company CustomerName 
from approvedoc,buying_document 
where approvedoc.IDTypeDoc in(13,15) 
and approvedoc.IDApproveDoc=buying_document.document_id and buying_document.company like '".$my_data."%' ";
	$result = mysql_query($sql);
	
	if($result)
	{
		while($row=mysql_fetch_array($result))
		{
			echo $row['CustomerName']."\n";
		}
	}
	mysql_close($connection);
?>